package com.yuliang.vueblog.common;

import lombok.Data;

import java.io.Serializable;

//定义java接口
@Data
public class Result implements Serializable {

    private String code;
    private String msg;
    private Object data;
    public static Result succ(Object data){
        Result m = new Result();
        m.setCode("200");
        m.setData(data);
        m.setMsg("sucess");
        return m;
    }

    public static Result succ(String mess,Object data){
        Result m = new Result();
        m.setCode("200");
        m.setData(data);
        m.setMsg(mess);
        return m;
    }

    public static Result fail(String mess){

        return fail(mess,null);
    }

    public static Result fail(String mess,Object data){
        Result m = new Result();
        m.setCode("500");
        m.setData(data);
        m.setMsg(mess);
        return m;
    }

    public static Result fail(String code,String msg,Object data){
        Result m = new Result();
        m.setCode(code);
        m.setMsg(msg);
        m.setData(data);
        return m;
    }



}
